#include <limits>
namespace SSlik{
template<class Model>
class Likelihood{
	public:
		Likelihood(Model* M, int p)
		{
			_M=M;
			_p=p;
			
		}
		double operator()(mat theta, int Nb)
		{
			if(!((*_M).Constraints(theta)))
			{
				int m=theta.n_cols;
				Resample::SysResample R;
				PF<Model,Resample::SysResample> P(Nb,_M,&R,theta,(*_M).Get_T());
			       (P).Filter();
			
		       	       return (P).Get_Z();	   
			}else{
				//cout << "hello";
				return -numeric_limits<double>::infinity();
			}	
		}
		int Get_p(void){return _p;}
		
	private:
	Model* _M;
	int _p;
};
}
